package com.eshore.textanalyzer.elk.utils;

import com.eshore.textanalyzer.elk.pojo.ToEsData;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @author xyd
 * @date 2021/5/18
 * 数据库连接 封装
 */
public class DBHepler {

    public static Connection conn = null;

    public static Connection getConn(ToEsData toEsData) {
        try {
            Class.forName(toEsData.getClassName());
            conn = DriverManager.getConnection(toEsData.getUrl(), toEsData.getUserName(), toEsData.getPassword());//获取连接
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }
}
